import request from '@/utils/request'

//查询员工列表
export const queryPageApi = (name,gender,begin,end,deptName,jobName,status,page,pageSize) => request.get(`/emps?name=${name}&gender=${gender}&begin=${begin}&end=${end}&deptName=${deptName}&jobName=${jobName}&status=${status}&page=${page}&pageSize=${pageSize}`)

//添加员工
export const addEmpApi = (data) => request.post('/emps', data)

//根据ID查询员工信息
export const queryInfoApi = (id) => request.get(`/emps/${id}`)

//修改员工信息
export const updateEmpApi = (data) => request.put('/emps', data)

//删除员工
export const deleteEmpApi = (ids) => request.delete(`/emps?ids=${ids}`)

//查询所有员工
export const queryAllApi = () => request.get(`/emps/list`)

//获取员工部门和职位信息
export const getEmployeeDeptJobApi = (empId) => request.get(`/emps/${empId}/dept-job`)

//获取待处理保养数量
export const getPendingMaintenanceCountApi = (empName) => request.get(`/appointments/maintenance/confirmed-count`, { params: { empName: empName } })

//获取待处理维修数量
export const getPendingRepairCountApi = (empName) => request.get(`/appointments/repair/confirmed-count`, { params: { empName: empName } })

//获取已完成保养数量
export const getCompletedMaintenanceCountApi = (empName) => request.get(`/appointments/maintenance/completed-count`, { params: { empName: empName } })

//获取已完成维修数量
export const getCompletedRepairCountApi = (empName) => request.get(`/appointments/repair/completed-count`, { params: { empName: empName } })

//更新员工状态为空闲
export const updateEmployeeStatusApi = (empId) => request.put(`/emps/${empId}/status`, {})
